﻿using System;
using System.Windows;
using PureMVC.Interfaces;
using GameEngine.Model.Data;
using System.Collections.Generic;

namespace GameEngine.Model
{
    public class IGameDataProxyConstants<IdType>
        where IdType : IComparable<IdType>
    {
        //public const string THINGCHANGED_NOTIFICATION = "ThingDataProxyChanged";
        //public const string THINGCHANGEDHEIGHT_NOTIFICATIONTYPE = "ThingDataProxyHeightChanged";
        //public const string MAPPOSITIONCHANGED_NOTIFICATIONTYPE = "DataProxyMapPositionChanged";
        //public const string THINGCHANGEDPOSITION_NOTIFICATIONTYPE = "ThingDataProxyPositionChanged";
        public static string CreateDataProxyName(IGameVO<IdType> vo)
        {
            return CreateDataProxyName(vo.Id);
        }

        public static string CreateDataProxyName(IGameVOId id)
        {
            return id.Value + "_gameDataProxy";
        }

        public static IGameDataProxy<IdType> GetGameDataProxy(IGameVOId gameName)
        {
            return ApplicationFacade.Instance.RetrieveProxy(CreateDataProxyName(gameName)) as IGameDataProxy<IdType>;
        }

    }
    public interface IGameDataProxy<IdType> : IDataProxy
        where IdType : IComparable<IdType>
    {
        string LEVELCHANGE_NOTIFICATION { get; }
        string TILESIZEUPDATED_NOTIFICATION { get; }
        string TILEHEIGHTUNITUPDATED_NOTIFICATION { get; }
        string MAXHEIGHTUPDATED_NOTIFICATION { get; }
        string MINHEIGHTUPDATED_NOTIFICATION { get; }
        
        string LEVELADDED_NOTIFICATION { get;  }
        string LEVELREMOVED_NOTIFICATION { get; }
        string THINGTYPEADDED_NOTIFICATION { get; }
        string THINGTYPEREMOVED_NOTIFICATION { get; }
        string RESOURCEADDED_NOTIFICATION { get; }
        string RESOURCEREMOVED_NOTIFICATION { get; }
        string VIEWADDED_NOTIFICATION { get; }
        string VIEWREMOVED_NOTIFICATION { get; }
        string VIEWSTATEADDED_NOTIFICATION { get; }
        string VIEWSTATEREMOVED_NOTIFICATION { get; }

        IGameVO<IdType> VO { get; }
        IGameVOId Id { get; }

        string Name { get; set; }
        float MaxHeight { get; set; }
        float MinHeight { get; set; }
        float TileHeightUnit { get; set; }
        Point TileSize { get; set; }

        ILevelDataProxy<IdType> CurrentLevel { get; set; }
        ILevelDataProxy<IdType> NextLevel { get; }

        List<IViewStateVO> ViewStates { get; }
        IDictionary<IThingTypeVOId, IThingTypeVO<IdType>> ThingTypes { get; }
        IDictionary<IViewVOId<IdType>, IViewVO<IdType>> Views { get; }
        IDictionary<ILevelVOId, ILevelVO<IdType>> Levels { get; }
        IDictionary<IResourceVOId,IResourceVO> Resources { get; }

        IThingTypeDataProxy<IdType> RetrieveThingTypeDataProxy(IThingTypeVO<IdType> vo);

        void AddLevel(ILevelDataProxy<IdType> thingType);
        void RemoveLevel(ILevelVOId thingType);
        void AddThingType(IThingTypeDataProxy<IdType> thingType);
        void RemoveThingType(IThingTypeVOId thingType);
        void AddResource(IResourceDataProxy thingType);
        void RemoveResource(ResourceVOId thingType);
        void AddView(IViewDataProxy<IdType> thingType);
        void RemoveView(IViewVOId<IdType> thingType);
        void AddViewState(ViewStateVO thingType);
        void RemoveViewState(ViewStateVO thingType);
    }    
}